home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-04-14 | 1.8 KB | 66 lines | [TEXT/MACA] |
- /*
- * File: OutlineButton.c -- useritem installer to outline the default button in dialogs.
- * Notes: Call while the dialog is still invisible.
- */
-
- #include <MacTypes.h>
- #include <DialogMgr.h>
-
- /*
- * Outlining is done by installing an user item surrounding the OK button.
- * The user item procedure then draws the border. This procedure will be called by the
- * Dialog Manager whenever the area containing the OK button needs
- * updating. The simple method of just drawing into the dialog window
- * will fail if any update events are generated -- DrawDialogs() may trash
- * part of the border.
- *
- * CAVEATS: the useritem must have a higher item number than the button
- * being highlit.
- */
-
-
- /* Forward references */
- pascal void buttonProc();
-
- void
- OutlineButton(theDialog, defaultID, useritemID)
- DialogPtr theDialog;
- int defaultID;
- int useritemID;
- {
- int itype;
- Handle cHandle;
- Rect outlineBox;
-
- /* Get the location of the default button. */
- GetDItem(theDialog, defaultID, &itype, &cHandle, &outlineBox);
-
- /* Set up the useritem to wrap around the OK button and have
- * userProc() as its drawing function.
- */
- InsetRect(&outlineBox, -4, -4);
- SetDItem(theDialog, useritemID, userItem, (Handle) buttonProc, &outlineBox);
- }
-
- /*
- * buttonProc: useritem procedure to draw the border around the OK (or other default)
- * button.
- */
-
- static pascal void
- buttonProc(theWindow, itemNo)
- WindowPtr theWindow;
- int itemNo;
- {
- int itype;
- Handle cHandle;
- Rect outlineBox;
-
- /* Retrieve the outline box. */
- GetDItem((DialogPtr)theWindow, itemNo, &itype, &cHandle, &outlineBox);
-
- PenSize(3,3);
- FrameRoundRect(&outlineBox, 16, 16);
- PenSize(1,1);
- }